/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package snake;

import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Administrator
 */
public class ImageCache {
    public static final ImageCache IMAGE_CACHE = new ImageCache();
    private Map<String, Image> images = new HashMap();

    private ImageCache() {
        final ImageIcon imageIcon = new ImageIcon("images.jpg");

        // 获取图片
        Image image = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("images.jpg"));
        images.put("oper", image);
    }

    public static Image getImage(String key) {
        return IMAGE_CACHE.images.get(key);
    }
}
